package com.taobao.txc.common.util.b;

import com.taobao.txc.common.LoggerInit;
import com.taobao.txc.common.LoggerWrap;
import com.taobao.txc.common.b.b;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import org.apache.commons.lang.StringUtils;

public class e
{
  private static final LoggerWrap a = LoggerInit.logger;
  private static String b = "/home/admin";
  private static String c = "/.txc/";
  
  private static File b(String paramString1, String paramString2)
  {
    StringBuilder localStringBuilder = new StringBuilder(b);
    localStringBuilder.append(c).append(paramString1).append('/').append(paramString2);
    File localFile = new File(localStringBuilder.toString());
    if (!localFile.exists())
    {
      if ((!localFile.getParentFile().exists()) && (!localFile.getParentFile().mkdirs())) {
        return null;
      }
      try
      {
        if (!localFile.createNewFile()) {
          return null;
        }
      }
      catch (IOException localIOException)
      {
        a.a(b.p, localIOException);
        return null;
      }
    }
    return localFile;
  }
  
  public static boolean a(String paramString1, String paramString2, String paramString3)
  {
    if (StringUtils.isEmpty(paramString3)) {
      return false;
    }
    File localFile = b(paramString1, paramString2);
    if (localFile == null) {
      return false;
    }
    FileOutputStream localFileOutputStream = null;
    try
    {
      localFileOutputStream = new FileOutputStream(localFile);
      localFileOutputStream.write(paramString3.getBytes());
      boolean bool;
      return true;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      a.a(b.p, localFileNotFoundException);
      bool = false;
      return bool;
    }
    catch (IOException localIOException2)
    {
      a.a(b.p, localIOException2);
      bool = false;
      return bool;
    }
    finally
    {
      if (localFileOutputStream != null) {
        try
        {
          localFileOutputStream.close();
        }
        catch (IOException localIOException5) {}
      }
    }
  }
  
  public static String a(String paramString1, String paramString2)
  {
    StringBuilder localStringBuilder1 = new StringBuilder(b);
    localStringBuilder1.append(c).append(paramString1).append('/').append(paramString2);
    File localFile = new File(localStringBuilder1.toString());
    BufferedReader localBufferedReader = null;
    try
    {
      localBufferedReader = new BufferedReader(new FileReader(localFile));
      StringBuilder localStringBuilder2 = new StringBuilder();
      str1 = null;
      while ((str1 = localBufferedReader.readLine()) != null) {
        localStringBuilder2.append(str1).append("\r\n");
      }
      String str2 = localStringBuilder2.toString();
      return str2;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      str1 = null;
      return str1;
    }
    catch (IOException localIOException1)
    {
      String str1 = null;
      return str1;
    }
    finally
    {
      if (localBufferedReader != null) {
        try
        {
          localBufferedReader.close();
        }
        catch (IOException localIOException5) {}
      }
    }
  }
  
  static
  {
    String str = System.getProperty("user.home");
    if (!StringUtils.isEmpty(str)) {
      b = str;
    }
  }
}


/* Location:           C:\Users\ibm\Downloads\txc-yun-sample (1)\txc-yun-sample\lib\txc-client-2.0.72.jar
 * Qualified Name:     com.taobao.txc.common.util.b.e
 * JD-Core Version:    0.7.0.1
 */